Many software applications, including database servers, read items from and write items to persistent storage. The types of items that are read and written vary based on the nature of the software application. For example, a database server may read and write data blocks, while a spreadsheet may read and write spreadsheet files. Each of the items used by such software applications typically has a primary copy that is stored on the persistent storage, such as a magnetic disk. The storage mechanism on which the primary copies of items are stored is referred to as “primary storage”.
At any given time, there may also exist one or more temporary copies of the items. For example, when an item is read or updated by the software application, a temporary copy of the item must be loaded into the volatile memory in which the software application is executing (the “local memory” of the software application). Updates are applied to the temporary copy in the local memory. For the updates to be permanent, the temporarily copy must eventually be written back to the primary storage.
To improve the performance of software applications that read items from and write items to persistent storage, temporary copies of the items may be stored in a storage mechanism that provides faster access than the primary storage. Storage that is used to hold temporary copies of items in order to decrease the time required to access the items is referred to as a “cache”.
Typically, caches are smaller but faster than primary storage. For example, if the primary storage is a magnetic disk, then temporary copies of the items may be stored on a smaller faster magnetic disk, a flash drive, a volatile memory, etc. One system that uses an intermediate cache to store items as the items are transferred between local memory and primary storage is described in U.S. patent application Ser. No. 12/631,985.
In a typical system that uses an intermediate cache, the intermediate cache is searched whenever the software application needs a copy of an item that does not reside in local memory. If a copy of the item is present in the intermediate cache, then the copy is provided from the intermediate cache. The item is only retrieved from its primary storage if no copy of the item is present in the intermediate cache.
Unfortunately, even though the storage mechanism that is used as an intermediate cache is generally faster than the storage mechanism used for primary storage, there may be circumstances in which retrieving data from an intermediate cache rather than the primary storage is undesirable. Thus, techniques are described hereafter for intelligently handling requests for items in a system that employs an intermediate cache.